package master2;

import java.util.Deque;
import java.util.LinkedList;

/**
 * @author chenyw
 * @date 2022/9/24 20:16
 * 各位相加
 */
public class M258addDigits {
    public int addDigits(int num) {
        while (num > 9) {
            int sum = 0;
            while (num > 0) {
                int tmp = num % 10;
                sum += tmp;
                num /= 10;
            }
            num = sum;
        }
        return num;
    }
}
